<?php
$params  = array('foo' => 'bar');

$viewArray = $this->linkToCurrentPage;
$viewArray['ViewStyle'] = 'list';

$viewOptions = array(
	'query' => $viewArray
);
$nextOptions = array(
	'query' => $this->linkToNextPage
);
$prevOptions = array(
	'query' => $this->linkToPreviousPage
);
?>

<div class="newTitleDiv clearfix">
	<h2 class="newTitleNoBg"><?php echo $this->departmentName;?></h2>
	<div class="newTitleShadow"></div>
	<div class="newTitleBg"></div>
</div>
<div class="titleDiv">
	<h2><?php echo $this->categoryName;?></h2>
	<div class="holder">
		<p><a class="view1"></a><a href="<?php echo $this->Url('catalog', $params, $viewOptions);?>" class="view2"></a></p>
		<div class="sort-holder">
			<span>Sort By</span>
			<ul>
				<li><a href="#">Name</a></li>
				<li><a href="#">Price</a></li>
				<li><a href="#">Brand</a></li>
				<li><a href="#">Relevance</a></li>
			</ul>
		</div>
	</div>
</div>
<div class="contentBox contentBox2 contentBox3">
	<div class="latestProductsArea clearfix">
	<?php
	if($this->lstProducts){
	foreach($this->lstProducts as $item)
	{
		$text = <<<_END
		<div class="latestProduct">
			<div class="latestProductImage">
				<img src="images/products_nex.png" alt="" />
			</div>
			<div class="latestProductInfo clearfix">
				<div class="latestPIL">
					<p>%s</p>
					<a href="#" class="star1"></a>
					<a href="#" class="star1"></a>
					<a href="#" class="star1"></a>
					<a href="#" class="star1"></a>
					<a href="#" class="star1"></a>
				</div>
				<div class="latestPIR">1049<sup>.000</sup><sub>usd</sub></div>
			</div>
			<div class="productButtons">
				<a href="product.html" class="productsMoreBtn">Chi tiết</a>
				<a href="shopping_cart.html" class="productsMoreBtn">Thêm vào giỏ</a>
			</div>
		</div>
_END;
		echo sprintf($text,$item->Name);
		

	}}
	?>
	</div>	
	<div class="latestProductsNav">
	<?php 
	if($this->totalPages > 1)
	{
		echo '<ul class="clearfix">';
		echo '<li class="prev">'; if($this->linkToPreviousPage) echo '<a href="' . $this->Url('catalog', $params, $prevOptions) . '">&lt;</a></li>';
			for ($i=1; $i <= $this->totalPages; $i++)
			{
			  	if($i==$this->pageNo)
			  		echo '<li><a class="activeLPN">'.$i.'</a></li>';
			  	else
			  	{
			  		$var = $this->linkToCurrentPage;
			  		$var['page'] = $i;
			  		$toPageOptions = array(
			  			'query' => $var
			  		);
					echo '<li><a href="'. $this->Url('catalog', $params, $toPageOptions) .'">'.$i.'</a></li>';
			  	}			  				
			}
		echo '<li class="next">'; if($this->linkToNextPage) echo '<a href="' . $this->Url('catalog', $params, $nextOptions) . '">&gt;</a></li>';
		echo '</ul>';
	}
	?>
	</div>
</div>


				<div class="titleDiv titleDiv2">
				<h2>Related Products</h2>
			</div>
			<div class="relatedProducts">
				<ul>
					<li class="relProduct">
						<div class="relProductImage">
							<a href="product.html"><img src="images/related-product-image1.png" alt="" /></a>
						</div>
						<div class="relProductInfo">
							<p><a href="product.html">vizio m221 nv</a></p>
							<div>259<sup>.99</sup><sub>usd</sub></div>
						</div>
					</li>
					<li class="relProduct">
						<div class="relProductImage">
							<a href="product.html"><img src="images/related-product-image2.png" alt="" /></a>
						</div>
						<div class="relProductInfo">
							<p><a href="product.html">sennheiser pxc</a></p>
							<div>1199<sup>.99</sup><sub>usd</sub></div>
						</div>
					</li>
					<li class="relProduct">
						<div class="relProductImage">
							<a href="product.html"><img src="images/related-product-image3.png" alt="" /></a>
						</div>
						<div class="relProductInfo">
							<p><a href="product.html">ipad2</a></p>
							<div>559<sup>.99</sup><sub>usd</sub></div>
						</div>
					</li>
					<li class="relProduct">
						<div class="relProductImage">
							<a href="product.html"><img src="images/related-product-image4.png" alt="" /></a>
						</div>
						<div class="relProductInfo">
							<p><a href="product.html">macbook air</a></p>
							<div>1259<sup>.99</sup><sub>usd</sub></div>
						</div>
					</li>
				</ul>
			</div>